home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / QD3DShader.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-17  |  7.6 KB  |  286 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DShader.h
  3.  
  4.      Contains:    QuickDraw 3D Shader / Color Routines                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DSHADER__
  19. #define __QD3DSHADER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=power
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47. #if PRAGMA_ENUM_ALWAYSINT
  48.     #pragma enumsalwaysint on
  49. #elif PRAGMA_ENUM_OPTIONS
  50.     #pragma option enum=int
  51. #elif PRAGMA_ENUM_PACK
  52.     #if __option(pack_enums)
  53.         #define PRAGMA_ENUM_PACK__QD3DSHADER__
  54.     #endif
  55.     #pragma options(!pack_enums)
  56. #endif
  57.  
  58. /******************************************************************************
  59.  **                                                                             **
  60.  **                                RGB Color routines                             **
  61.  **                                                                             **
  62.  *****************************************************************************/
  63. EXTERN_API_C( TQ3ColorRGB *)
  64. Q3ColorRGB_Set                    (TQ3ColorRGB *            color,
  65.                                  float                     r,
  66.                                  float                     g,
  67.                                  float                     b);
  68.  
  69. EXTERN_API_C( TQ3ColorARGB *)
  70. Q3ColorARGB_Set                    (TQ3ColorARGB *            color,
  71.                                  float                     a,
  72.                                  float                     r,
  73.                                  float                     g,
  74.                                  float                     b);
  75.  
  76. EXTERN_API_C( TQ3ColorRGB *)
  77. Q3ColorRGB_Add                    (const TQ3ColorRGB *    c1,
  78.                                  const TQ3ColorRGB *    c2,
  79.                                  TQ3ColorRGB *            result);
  80.  
  81. EXTERN_API_C( TQ3ColorRGB *)
  82. Q3ColorRGB_Subtract                (const TQ3ColorRGB *    c1,
  83.                                  const TQ3ColorRGB *    c2,
  84.                                  TQ3ColorRGB *            result);
  85.  
  86. EXTERN_API_C( TQ3ColorRGB *)
  87. Q3ColorRGB_Scale                (const TQ3ColorRGB *    color,
  88.                                  float                     scale,
  89.                                  TQ3ColorRGB *            result);
  90.  
  91. EXTERN_API_C( TQ3ColorRGB *)
  92. Q3ColorRGB_Clamp                (const TQ3ColorRGB *    color,
  93.                                  TQ3ColorRGB *            result);
  94.  
  95. EXTERN_API_C( TQ3ColorRGB *)
  96. Q3ColorRGB_Lerp                    (const TQ3ColorRGB *    first,
  97.                                  const TQ3ColorRGB *    last,
  98.                                  float                     alpha,
  99.                                  TQ3ColorRGB *            result);
  100.  
  101. EXTERN_API_C( TQ3ColorRGB *)
  102. Q3ColorRGB_Accumulate            (const TQ3ColorRGB *    src,
  103.                                  TQ3ColorRGB *            result);
  104.  
  105. EXTERN_API_C( float *)
  106. Q3ColorRGB_Luminance            (const TQ3ColorRGB *    color,
  107.                                  float *                luminance);
  108.  
  109. /******************************************************************************
  110.  **                                                                             **
  111.  **                                Shader Types                                 **
  112.  **                                                                             **
  113.  *****************************************************************************/
  114.  
  115. enum TQ3ShaderUVBoundary {
  116.     kQ3ShaderUVBoundaryWrap        = 0,
  117.     kQ3ShaderUVBoundaryClamp    = 1
  118. };
  119. typedef enum TQ3ShaderUVBoundary TQ3ShaderUVBoundary;
  120.  
  121.  
  122. /******************************************************************************
  123.  **                                                                             **
  124.  **                                Shader Routines                                 **
  125.  **                                                                             **
  126.  *****************************************************************************/
  127. EXTERN_API_C( TQ3ObjectType )
  128. Q3Shader_GetType                (TQ3ShaderObject         shader);
  129.  
  130. EXTERN_API_C( TQ3Status )
  131. Q3Shader_Submit                    (TQ3ShaderObject         shader,
  132.                                  TQ3ViewObject             view);
  133.  
  134. EXTERN_API_C( TQ3Status )
  135. Q3Shader_SetUVTransform            (TQ3ShaderObject         shader,
  136.                                  const TQ3Matrix3x3 *    uvTransform);
  137.  
  138. EXTERN_API_C( TQ3Status )
  139. Q3Shader_GetUVTransform            (TQ3ShaderObject         shader,
  140.                                  TQ3Matrix3x3 *            uvTransform);
  141.  
  142. EXTERN_API_C( TQ3Status )
  143. Q3Shader_SetUBoundary            (TQ3ShaderObject         shader,
  144.                                  TQ3ShaderUVBoundary     uBoundary);
  145.  
  146. EXTERN_API_C( TQ3Status )
  147. Q3Shader_SetVBoundary            (TQ3ShaderObject         shader,
  148.                                  TQ3ShaderUVBoundary     vBoundary);
  149.  
  150. EXTERN_API_C( TQ3Status )
  151. Q3Shader_GetUBoundary            (TQ3ShaderObject         shader,
  152.                                  TQ3ShaderUVBoundary *    uBoundary);
  153.  
  154. EXTERN_API_C( TQ3Status )
  155. Q3Shader_GetVBoundary            (TQ3ShaderObject         shader,
  156.                                  TQ3ShaderUVBoundary *    vBoundary);
  157.  
  158.  
  159. /******************************************************************************
  160.  **                                                                             **
  161.  **                            Illumination Shader    Classes                         **
  162.  **                                                                             **
  163.  *****************************************************************************/
  164. EXTERN_API_C( TQ3ObjectType )
  165. Q3IlluminationShader_GetType    (TQ3ShaderObject         shader);
  166.  
  167. EXTERN_API_C( TQ3ShaderObject )
  168. Q3PhongIllumination_New            (void);
  169.  
  170. EXTERN_API_C( TQ3ShaderObject )
  171. Q3LambertIllumination_New        (void);
  172.  
  173. EXTERN_API_C( TQ3ShaderObject )
  174. Q3NULLIllumination_New            (void);
  175.  
  176.  
  177. /******************************************************************************
  178.  **                                                                             **
  179.  **                                 Surface Shader                                 **
  180.  **                                                                             **
  181.  *****************************************************************************/
  182. EXTERN_API_C( TQ3ObjectType )
  183. Q3SurfaceShader_GetType            (TQ3SurfaceShaderObject  shader);
  184.  
  185.  
  186. /******************************************************************************
  187.  **                                                                             **
  188.  **                                Texture Shader                                 **
  189.  **                                                                             **
  190.  *****************************************************************************/
  191. EXTERN_API_C( TQ3ShaderObject )
  192. Q3TextureShader_New                (TQ3TextureObject         texture);
  193.  
  194. EXTERN_API_C( TQ3Status )
  195. Q3TextureShader_GetTexture        (TQ3ShaderObject         shader,
  196.                                  TQ3TextureObject *        texture);
  197.  
  198. EXTERN_API_C( TQ3Status )
  199. Q3TextureShader_SetTexture        (TQ3ShaderObject         shader,
  200.                                  TQ3TextureObject         texture);
  201.  
  202.  
  203. /******************************************************************************
  204.  **                                                                             **
  205.  **                                Texture Objects                                 **
  206.  **                                                                             **
  207.  *****************************************************************************/
  208. EXTERN_API_C( TQ3ObjectType )
  209. Q3Texture_GetType                (TQ3TextureObject         texture);
  210.  
  211. EXTERN_API_C( TQ3Status )
  212. Q3Texture_GetWidth                (TQ3TextureObject         texture,
  213.                                  unsigned long *        width);
  214.  
  215. EXTERN_API_C( TQ3Status )
  216. Q3Texture_GetHeight                (TQ3TextureObject         texture,
  217.                                  unsigned long *        height);
  218.  
  219.  
  220. /******************************************************************************
  221.  **                                                                             **
  222.  **                                Pixmap Texture                                 **
  223.  **                                                                             **
  224.  *****************************************************************************/
  225. EXTERN_API_C( TQ3TextureObject )
  226. Q3PixmapTexture_New                (const TQ3StoragePixmap * pixmap);
  227.  
  228. EXTERN_API_C( TQ3Status )
  229. Q3PixmapTexture_GetPixmap        (TQ3TextureObject         texture,
  230.                                  TQ3StoragePixmap *        pixmap);
  231.  
  232. EXTERN_API_C( TQ3Status )
  233. Q3PixmapTexture_SetPixmap        (TQ3TextureObject         texture,
  234.                                  const TQ3StoragePixmap * pixmap);
  235.  
  236.  
  237. /******************************************************************************
  238.  **                                                                             **
  239.  **                                Mipmap Texture                                 **
  240.  **                                                                             **
  241.  *****************************************************************************/
  242. EXTERN_API_C( TQ3TextureObject )
  243. Q3MipmapTexture_New                (const TQ3Mipmap *        mipmap);
  244.  
  245. EXTERN_API_C( TQ3Status )
  246. Q3MipmapTexture_GetMipmap        (TQ3TextureObject         texture,
  247.                                  TQ3Mipmap *            mipmap);
  248.  
  249. EXTERN_API_C( TQ3Status )
  250. Q3MipmapTexture_SetMipmap        (TQ3TextureObject         texture,
  251.                                  const TQ3Mipmap *        mipmap);
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258. #if PRAGMA_ENUM_ALWAYSINT
  259.     #pragma enumsalwaysint reset
  260. #elif PRAGMA_ENUM_OPTIONS
  261.     #pragma option enum=reset
  262. #elif defined(PRAGMA_ENUM_PACK__QD3DSHADER__)
  263.     #pragma options(pack_enums)
  264. #endif
  265.  
  266. #if PRAGMA_STRUCT_ALIGN
  267.     #pragma options align=reset
  268. #elif PRAGMA_STRUCT_PACKPUSH
  269.     #pragma pack(pop)
  270. #elif PRAGMA_STRUCT_PACK
  271.     #pragma pack()
  272. #endif
  273.  
  274. #ifdef PRAGMA_IMPORT_OFF
  275. #pragma import off
  276. #elif PRAGMA_IMPORT
  277. #pragma import reset
  278. #endif
  279.  
  280. #ifdef __cplusplus
  281. }
  282. #endif
  283.  
  284. #endif /* __QD3DSHADER__ */
  285.  
  286.